package com.windfone.web.action;

import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import com.windfone.common.StringUtil;
import com.windfone.model.Product;
import com.windfone.service.ProductService;

public class MobileCenterAction extends ActionSupport {
	private ProductService productService;
	private String typeId ;
	private String status ;
	private List<Product> products;
	public List<Product> getProducts() {
		return products;
	}

	public String getTypeId() {
		return typeId;
	}

	public void setTypeId(String typeId) {
		this.typeId = typeId;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public void setProducts(List<Product> products) {
		this.products = products;
	}

	public void setProductService(ProductService productService) {
		this.productService = productService;
	}

	@Override
	public String execute() throws Exception {
		if ( typeId !=null && !"".equals( typeId) && StringUtil.isInteger( typeId ) &&  status !=null && !"".equals( status) && StringUtil.isInteger( status ))	{
			products = productService.getAllProductByStatus( Integer.parseInt(typeId),Integer.parseInt(status));
		}
		return SUCCESS;
	}
 
	
}
